package com.itheima.controller;

import com.itheima.pojo.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@Api(tags = "swagger 接口服务测试",description ="为swagger提供服务接口")
public interface SwaggerIntetface  {
    //测试无参接口
    @ApiOperation("测试 hello 方法")
    @GetMapping("hello")
    String hello();

    //测试 queryString(问号传参) 风格的参入参数
    @ApiOperation("queryString测试方法")
    @GetMapping
    Student modifyStudentNum(@RequestParam("num") String num);

    //测试Restful风格的参入参数(path)
    @ApiOperation("RestFul测试方法")
    @ApiImplicitParam(name = "name",value = "学生姓名",required = true,dataType = "String"
    ,paramType = "query")
    @GetMapping("{name}")
    Student modifyStudentName(@PathVariable("name") String name);

    //请求体传参(json格式的数据

    @ApiOperation("json格式测试方法")
    @PostMapping
    Student modifyStudent(@RequestBody Student student);

    //综合测试
    @ApiOperation("综合参数测试方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name",value = "学生姓名",required = true,dataType = "String"
                    ,paramType = "query"),
            @ApiImplicitParam(name = "id",value = "学生的编号",required = true,dataType = "String"
            ,paramType = "path")
    })
    @PutMapping("{id}")
    Student mofidyStudentBynNum(@PathVariable("id") String id,
                                @RequestParam("name") String name,
                                @RequestBody Student student);
}
